 // Decompiled by Jad v1.5.8g. Copyright 2001 Pavel Kouznetsov.
 // Jad home page: http://www.kpdus.com/jad.html
 // Decompiler options: packimports(3) 
 // Source File Name:   TableCell.java

 package com.jb.web.bean;

 import com.jb.framework.PersistentContext;
 import com.jb.web.bean.inspector.OptionPropertyEditor;
 import com.jb.web.renderer.TableCellRenderer;

 // Referenced classes of package com.jb.web.bean:
 //            Region, TableRow, ChildTypeNotAllowedException, ValueHolder, 
 //            BaseComponent, Table

 public class TableCell extends Region
     implements ValueHolder
 {

     private void $init$()
     {
         colSpan = 1;
         rowSpan = 1;
         align = "left";
     }

     public void setAlign(String align)
     {
         this.align = align;
     }

     public String getAlign()
     {
         return align;
     }

     public void setColSpan(int colSpan)
     {
         this.colSpan = colSpan;
     }

     public int getColSpan()
     {
         return colSpan >= 1 ? colSpan : 1;
     }

     public void setDefault(PersistentContext pCtx)
     {
         setAlign("Left");
         setStyleClass("jbTableCell");
     }

     private Class getDefaultRendererType()
     {
         return TableCellRenderer.class;
     }

     public TableRow getMyRow()
     {
         return (TableRow)getParent();
     }

     public void setRowSpan(int rowSpan)
     {
         this.rowSpan = rowSpan;
     }

     public int getRowSpan()
     {
         return rowSpan >= 1 ? rowSpan : 1;
     }

     public void setVerticalAlign(String verticalAlign)
     {
         this.verticalAlign = verticalAlign;
     }

     public String getVerticalAlign()
     {
         return verticalAlign;
     }

     public void delete(PersistentContext pCtx)
     {
         super.delete(pCtx);
         getRow().setCols(getRow().getCols() - 1);
     }

     public String toString()
     {
         return (new StringBuilder()).append("Cell").append(getSequence()).toString();
     }

     protected void init()
     {
         super.init();
         setValue(null);
     }

     protected void parentAcceptable(BaseComponent parent)
         throws ChildTypeNotAllowedException
     {
         if(parent instanceof TableRow)
             return;
         else
             throw new ChildTypeNotAllowedException("Table cell can only be added to table row");
     }

     private TableRow getRow()
     {
         return (TableRow)getParent();
     }

     private Table getTable()
     {
         return getRow().getTable();
     }

     public TableCell()
     {
         $init$();
     }

     static final long serialVersionUID = 0x1e0f3L;
     private String verticalAlign;
     private int colSpan;
     private int rowSpan;
     private String align;

     static 
     {
         publish(TableCell.class, "Style", "overFlow");
         publish(TableCell.class, "Style", "colSpan");
         publish(TableCell.class, "Style", "rowSpan");
         publish(TableCell.class, "Model", "value");
         publish(TableCell.class, "Style", "wrap", new OptionPropertyEditor("seeded:wrap"));
         publish(TableCell.class, "Style", "align", new OptionPropertyEditor("seeded:cellAlign"));
         publish(TableCell.class, "Style", "verticalAlign", new OptionPropertyEditor("seeded:vCellAlign"));
     }
 }
